{include file="public/head"}
    <body>
    <div class="x-body">
        <div  class="lotus-nav" >
            <button class="layui-btn  layui-btn-sm"
                    onclick="x_admin_show('添加','add.html?type=5',650)">添加
            </button>

            <!-- <button onclick="javascript:location.reload()" class="layui-btn  "><i class="icon iconfont ">&#xe6aa;</i></button> -->
            <span class="x-right"><button onclick="javascript:location.reload()" class="layui-btn-default "><i class="layui-icon layui-icon-refresh"></i></button></span>

        </div>

    <table class="layui-table">
        <thead>
          <tr>
            <th>ID</th>
            <th>类型</th>
            <th>名称</th>
            <th>图片</th>
            <th>链接</th>
            <th>权重</th>
            <th>状态</th>
            <th>操作</th>
        </thead>
        <tbody>

        {volist name="data" id="vo"}
        	<tr>
	            <td>{$vo.id}</td>
	            <td>{switch($vo.type)}{case 1}背景图{/case}{case 2}管家电话{/case}{case 3}在线客服{/case}{case 5}顶部轮播图{/case}{default/}底部模块{/switch}</td>
	            <td>{$vo.title}</td>
                <td>
                    <img src="{$vo.image|imgadd}" style="height:60px">
                </td>
	            <td>{$vo.link}</td>
	            <td>
                    {if condition="$vo.type==4 || $vo.type==5"}
                    {$vo.rank}
                    {/if}
                </td>
                <td>
                    {if condition="$vo.type==4 || $vo.type==5"}
                    {eq name="$vo.status" value="1"}显示{else/}隐藏{/eq}
                    {/if}
                </td>
	            <td>
	                <button class="layui-btn layui-btn-xs" onclick="x_admin_show('编辑','edit.html?id={$vo.id}',650)">编辑</button>
                    {if condition="$vo.type==4 || $vo.type==5"}
                    <button class="layui-btn layui-btn-xs layui-btn-danger" onclick="del('{$vo.id}')">删除</button>
                    {/if}
	           </td>
	        </tr>
        {/volist}
       
        </tbody>
      </table>
    </div>
</body>
{include file="public/foot"}
<script>
    function del(id){
        layer.confirm('确认要删除吗？',function(index){
            //捉到所有被选中的，发异步进行删除
            $.post("/admin/config/delete", {id: id}, function(data, textStatus, xhr) {
                /*optional stuff to do after success */
                if(data.code==1){
                    layer.msg(data.msg,{icon:1,time:1000},function(){
                        location.reload();
                    });
                }else{
                    layer.msg(data.msg,{icon:2,time:1000});
                }

            });
        });
    }
</script>